package com.atguigu.gulimall.common.constant;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

@Data
public class ProductConstant {

    @Getter
    @AllArgsConstructor
    public enum AttrEnum {

        ATTR_TYPE_BASE(1, "基本属性"),

        ATTR_TYPE_SALE(0, "销售属性");

        private int code;
        private String msg;

        public static AttrEnum getEnumByCode(int code) {
            for (AttrEnum attrEnum : AttrEnum.values()) {
                if (attrEnum.getCode() == code) {
                    return attrEnum;
                }
            }
            return null;
        }
    }

}
